/**
 * Radio 组件的主题配置
 */

import type { ComponentToken } from 'antd/es/radio/style';

const RADIO_TOKENS = {
  radioSize: 16,
  dotSize: 8,
  dotColorDisabled: 'rgba(0, 0, 0, 0.25)',
  radioColor: '#ffffff',
  radioBgColor: '#1890ff',
} as const;

const BUTTON_TOKENS = {
  buttonBg: '#ffffff',
  buttonCheckedBg: '#ffffff',
  buttonColor: '#1a1a1a',
  buttonPaddingInline: 14,
  buttonCheckedBgDisabled: 'rgba(0, 0, 0, 0.06)',
  buttonCheckedColorDisabled: 'rgba(0, 0, 0, 0.25)',
  buttonSolidCheckedColor: '#ffffff',
  buttonSolidCheckedBg: '#1890ff',
  buttonSolidCheckedHoverBg: '#40a9ff',
  buttonSolidCheckedActiveBg: '#096dd9',
} as const;

const SPACING_TOKENS = {
  wrapperMarginInlineEnd: 8,
} as const;

export const radioThemeConfig: Partial<ComponentToken> = {
  radioSize: RADIO_TOKENS.radioSize,
  dotSize: RADIO_TOKENS.dotSize,
  dotColorDisabled: RADIO_TOKENS.dotColorDisabled as any,
  buttonBg: BUTTON_TOKENS.buttonBg,
  buttonCheckedBg: BUTTON_TOKENS.buttonCheckedBg,
  buttonColor: BUTTON_TOKENS.buttonColor as any,
  buttonPaddingInline: BUTTON_TOKENS.buttonPaddingInline,
  buttonCheckedBgDisabled: BUTTON_TOKENS.buttonCheckedBgDisabled as any,
  buttonCheckedColorDisabled: BUTTON_TOKENS.buttonCheckedColorDisabled as any,
  buttonSolidCheckedColor: BUTTON_TOKENS.buttonSolidCheckedColor,
  buttonSolidCheckedBg: BUTTON_TOKENS.buttonSolidCheckedBg,
  buttonSolidCheckedHoverBg: BUTTON_TOKENS.buttonSolidCheckedHoverBg,
  buttonSolidCheckedActiveBg: BUTTON_TOKENS.buttonSolidCheckedActiveBg,
  wrapperMarginInlineEnd: SPACING_TOKENS.wrapperMarginInlineEnd,
};

export const getRadioTheme = (
  customConfig?: Partial<ComponentToken>
): Partial<ComponentToken> => {
  return {
    ...radioThemeConfig,
    ...customConfig,
  };
};

export type { ComponentToken as RadioComponentToken } from 'antd/es/radio/style';

